/*
 * 컴파일을 위해 올려 놓은 소스 입니다.
 * 서버에 반영하지 마시고 다른국가에 적용할 경우 서버에 있는 class 를 카피해서 사용하십시오.
 * 
 */
package com.pushmsg.otaconf;

public class OtaConfWspHdr
{
	final private byte pushid = 0x01;  //PUSH ID / Transaction ID
	final private byte pdutype = 0x06; //PDU type(push)
	final private byte hdrlen = 0x2C;  //Headerslength(content type + headers)
	final private byte lengt30 = 0x1F; //Length greather than 30
	final private byte vallen = (byte)0x2A;
	private byte[] mime = null;
	final private byte  bnull = 0x00;
	final private byte charset = (byte)0x81;
	final private byte utf8 = (byte)0xEA;

	private byte[] data = null;
	
	public OtaConfWspHdr(String mode)
	{
		if(mode.equals("bm"))
			mime = new String("application/x-wap-prov.browser-bookmarks").getBytes();
		else
			mime = new String("application/x-wap-prov.browser-settings").getBytes();
		data = new byte[8+mime.length];
	}
	
	public byte[] getData()
	{
		int ndx=0;
		
		data[ndx++] = pushid;
		data[ndx++] = pdutype;
		data[ndx++] = hdrlen;
		data[ndx++] = lengt30;
		data[ndx++] = vallen;
		
		for(int i=0; i<mime.length; i++)
			data[ndx++] = mime[i];
		
		data[ndx++] = bnull;
		data[ndx++] = charset;
		data[ndx++] = utf8;

		return data;
	}
	
	public int getLength()
	{
		return data.length;
	}	
	
}